home *** CD-ROM | disk | FTP | other *** search
/ Power Programmierung 2 / Power-Programmierung CD 2 (Tewi)(1994).iso / c / library / dos / communic / pcmail / main / screen.h < prev    next >
Encoding:
C/C++ Source or Header  |  1994-06-05  |  5.0 KB  |  269 lines

  1. /*++
  2.  
  3. /* NAME
  4.  
  5. /*    screen
  6.  
  7. /* SUMMARY
  8.  
  9. /*    structure of mail shell command windows
  10.  
  11. /* PROJECT
  12.  
  13. /*    pc-mail
  14.  
  15. /* PACKAGE
  16.  
  17. /*    mail
  18.  
  19. /* SYNOPSIS
  20.  
  21. /*    #include "screen.h"
  22.  
  23. /* DESCRIPTION
  24.  
  25. /*    The data structures in this file are used by the interactive shell to 
  26.  
  27. /*    define what a screen looks like, and what commands the user can give.
  28.  
  29. /*
  30.  
  31. /*    For each screen, one has to define a table of (selector, command name, 
  32.  
  33. /*    help string, and function pointer) tuples.
  34.  
  35. /*    The command names are listed in the top window. If the user enters
  36.  
  37. /*    the type of input specified by the selector, the associated function
  38.  
  39. /*    is called. A null function pointer means go back to the calling screen. 
  40.  
  41. /*
  42.  
  43. /*    The table is terminated with a null selector entry; its help 
  44.  
  45. /*    string is displayed in the bottom window (as a prompt), and the 
  46.  
  47. /*    associated function is invoked upon entry of the screen.
  48.  
  49. /*
  50.  
  51. /*    The return value of an action function determines what happens next.
  52.  
  53. /*    An action function can signal an error condition, that the screen
  54.  
  55. /*    needs to be redrawn, and whether the calling screen should terminate.
  56.  
  57. /*
  58.  
  59. /*    User input can be of various forms: single-character, string or
  60.  
  61. /*    escape/enter.
  62.  
  63. /*
  64.  
  65. /*    In case of single-character input the selector fields should contain 
  66.  
  67. /*    for each key the (upper case) key code,
  68.  
  69. /*    a label that is displayed at the top of the screen, and a help
  70.  
  71. /*    text that explains the key's function. 
  72.  
  73. /*
  74.  
  75. /*    In case of string input the associated function is called with the 
  76.  
  77. /*    string input as argument. If that function returns an error status the
  78.  
  79. /*    text in the help field is printed in the error window and the 
  80.  
  81. /*    user is given another chance.
  82.  
  83. /*
  84.  
  85. /*    An alternative form of string input takes the text from the help field
  86.  
  87. /*    as default input, and allows the user to edit that. Otherwise the
  88.  
  89. /*    same functions are performed as with ordinary string input.
  90.  
  91. /*
  92.  
  93. /*    A third form of string input only accepts yes or no. The action
  94.  
  95. /*    function is called with an integer argument (1 = yes, 0 = no).
  96.  
  97. /*
  98.  
  99. /*    In case of escape/enter the interpreter invokes the action function when
  100.  
  101. /*    the user presses enter, and does nothing when escape is pressed. 
  102.  
  103. /* .nf
  104.  
  105.  
  106.  
  107.  /* there is a Screen structure for each command for each screen */
  108.  
  109.  
  110.  
  111. typedef struct {
  112.  
  113.     short   key;            /* type of input */
  114.  
  115.     char   *name;            /* key label (for top window) */
  116.  
  117.     int   (*action) ();            /* action when command is selected */
  118.  
  119.     char   *help;            /* explanation (for H command) */
  120.  
  121. } Screen;
  122.  
  123.  
  124.  
  125.  /* action function return masks */
  126.  
  127.  
  128.  
  129. #define    S_BREAK        1        /* return immediately after action */
  130.  
  131. #define    S_REDRAW    2        /* redraw screen */
  132.  
  133. #define    S_ERROR        4        /* action failed */
  134.  
  135.  
  136.  
  137.  /* input types: ordinary character keys are encoded as themselves */
  138.  
  139.  
  140.  
  141. #define    CTL(x)    (x ^ 0100)        /* ASCII control code */
  142.  
  143. #define    BS    CTL('H')
  144.  
  145. #define    ENTER    CTL('M')
  146.  
  147. #define    CTLU    CTL('U')
  148.  
  149. #define    ESC    CTL('[')
  150.  
  151. #define    DEL    CTL('?')
  152.  
  153.  
  154.  
  155. #define    ANY    256            /* press any key */
  156.  
  157. #define    UP    257            /* up-arrow key */
  158.  
  159. #define    DOWN    258            /* down-arrow key */
  160.  
  161. #define    LEFT    259            /* left-arrow key */
  162.  
  163. #define    RIGHT    260            /* right-arrow key */
  164.  
  165. #define    PGUP    261            /* page-up */
  166.  
  167. #define    PGDN    262            /* page-down */
  168.  
  169. #define    STRING    263            /* string input, ESC to quit */
  170.  
  171. #define    ESCCR    264            /* CR to confirm, ESC to quit */
  172.  
  173. #define    EDIT    265            /* edit string, ESC to quit */
  174.  
  175. #define    YESNO    266            /* yes or no, ESC to quit */
  176.  
  177.  
  178.  
  179. #define    iskey(key)    (key > 0 && key < STRING)
  180.  
  181.  
  182.  
  183.  /* system-dependent function-key labels */
  184.  
  185.  
  186.  
  187. #ifdef unix
  188.  
  189. #   define PgUp    "F1"
  190.  
  191. #   define PgDn "F2"
  192.  
  193. #endif
  194.  
  195.  
  196.  
  197. #ifdef MSDOS
  198.  
  199. #   define PgUp "PgUp"
  200.  
  201. #   define PgDn "PgDn"
  202.  
  203. #endif
  204.  
  205.  
  206.  
  207.  /* often-used strings and messages */
  208.  
  209.  
  210.  
  211. extern char anykey[];            /* Press any key to continue */
  212.  
  213. extern char initscreen[];        /* Return to initial screen */
  214.  
  215. extern char prevscreen[];        /* Return to previous screen */
  216.  
  217. extern char int_error[];        /* The program is confused */
  218.  
  219. extern char pageup[];            /* Move screen one page upwards */
  220.  
  221. extern char pagedn[];            /* Move screen one page downwards */
  222.  
  223. extern char csrup[];            /* Move cursor upwards */
  224.  
  225. extern char csrdn[];            /* Move cursor downwards */
  226.  
  227. extern char getsummary[];        /* Press ESC to cancel/give summary */
  228.  
  229. extern char getaddr[];            /* Press ESC to cancel/enter address */
  230.  
  231. extern char printcurr[];        /* Print current message */
  232.  
  233. extern char delcurr[];            /* Delete current message */
  234.  
  235. extern char *m_msgread[];        /* Cannot read that message */
  236.  
  237.  
  238.  
  239. /* SEE ALSO
  240.  
  241. /*    screen(3)    screen table implementation
  242.  
  243. /*    kbdinp(3)    screen table interpreter
  244.  
  245. /* AUTHOR(S)
  246.  
  247. /*    W.Z. Venema
  248.  
  249. /*    Eindhoven University of Technology
  250.  
  251. /*    Department of Mathematics and Computer Science
  252.  
  253. /*    Den Dolech 2, P.O. Box 513, 5600 MB Eindhoven, The Netherlands
  254.  
  255. /* CREATION DATE
  256.  
  257. /*    Wed Apr  1 21:14:53 GMT+1:00 1987
  258.  
  259. /* LAST MODIFICATION
  260.  
  261. /*    90/01/22 13:02:34
  262.  
  263. /* VERSION/RELEASE
  264.  
  265. /*    2.1
  266.  
  267. /*--*/
  268.  
  269.